#!/bin/bash
script_dir=$(cd "$(dirname "$0")"; pwd)
build_dir=$script_dir/build

build_type=$1
if [ -z "$build_type" ]; then
    build_type="Release"
fi

if [ -z "${ACIS_ROOT}"] ; then 
    export ACIS_ROOT=${script_dir}/../3rd/acis
fi


if [ -z "${INTEROP_ROOT}"] ; then 
    export INTEROP_ROOT=${script_dir}/../3rd//interOp
fi

export EXCHANE_SDK=${script_dir}/../
export LD_LIBRARY_PATH=${ACIS_ROOT}/linux_a64/code/bin:${INTEROP_ROOT}/linux_a64/code/bin:${env:LD_LIBRARY_PATH}
echo ${LD_LIBRARY_PATH}

bash setup.sh $build_type

rm -rf ${build_dir}
cmake -DCMAKE_BUILD_TYPE:STRING=$build_type  -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE  -DInterOp=on  --no-warn-unused-cli -S$script_dir -B$build_dir
cmake  --build $build_dir --config $build_dir  -j20 